/*
 *  Copyright (C) 2010 Glauco
 * 
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 * 
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 * 
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.balisunrise.samples;

import java.util.Calendar;
import javax.persistence.*;
import org.balisunrise.annotation.Create;
import org.balisunrise.annotation.Editor;
import org.balisunrise.annotation.Filter;
import org.balisunrise.annotation.Grid;
import org.balisunrise.annotation.Panel;
import org.balisunrise.annotation.Search;
import org.balisunrise.annotation.Transaction;
import org.balisunrise.annotation.VisualEntity;

/**
 *
cliinad
clidatnas
clilimcre
clifil
clinat
clisex
cliestciv
clidatspc
clifil2
clidatfun
clinomsoc
cliperdes
clicarfid
clitab
cliconfin
clinrocal
clinroman
CONJUGUE
LOCAL TRABALHO
DEPENDENTES
CONTATOS
REFERENCIAS
CATEGORIA
 * @author Glauco
 */
@Entity
@DiscriminatorValue("CLI")
@VisualEntity(transactions={
    @Transaction(alias="def",title="Cadastro de Clientes Pessoa Física", editor="def", search="def"),
    @Transaction(alias="jur",title="Cadastro de Clientes Pessoa Jurídica", editor="jur", search="jur")},
editors={
    @Editor(alias="def",title="Cliente",panel="def"),
    @Editor(alias="jur",title="Cliente",panel="jur")},
searchs={
    @Search(alias="def",title="Pesquisa de Clientes Pessoa Física",filter="def",grid="def"),
    @Search(alias="jur",title="Pesquisa de Clientes Pessoa Jurídica",filter="jur",grid="jur")},
panels={
    @Panel(alias={"def","jur"},title="Cliente")},
filters={
    @Filter(alias={"def","jur"},title="Filtros")},
grids={
    @Grid(alias={"def","jur"},title="Clientes")}
)
public class Cliente extends Pessoa{

    public Cliente() {
        super();
    }

    public void atualizaDataAlteracao(){
        this.setDataAlteracao(Calendar.getInstance().getTime());
    }

    @Create(alias="jur")
    public static Cliente createPessoaJuridica(){
        Cliente c = new Cliente();
        c.setTipoPessoa(TipoPessoa.JURIDICA);
        return c;
    }
}
